package sym0920;

import java.util.Scanner;

public class J05Ex35Charges {

	public static void main(String[] args) {
		
		//변수
		int pay=0; //청구금액
		int money=0; //지불금액
		int charge = 0; //잔돈
		int W50000=0;
		int W10000=0;
		int W5000=0;
		int W1000=0;
		int W500=0;
		int W100=0;
		int W50=0;
		int W10=0;
		Scanner sc = null;
		String result="";
		sc=new Scanner(System.in);
		//잔돈계산
		System.out.println("청구금액을 입력하세요");
		pay=sc.nextInt();
		System.out.println("지불금액을 입력하세요");
		money=sc.nextInt();
		
				
		charge=money-pay;
		result+="거스름돈은 "+charge+"원 입니다\n";
		W50000=(charge/50000);
		charge=(charge%50000);
		W10000=(charge/10000);
		charge=(charge%10000);
		W5000=(charge/5000);
		charge=(charge%5000);
		W1000=(charge/1000);
		charge=(charge%1000);
		W500=(charge/500);
		charge=(charge%500);
		W100=(charge/100);
		charge=(charge%100);
		W10=(charge/10);
		
		
		//잔돈계산
		result+="50000원권 "+W50000+"장, ";
		result+="10000원권 "+W10000+"장, ";
		result+="5000원권 "+W5000+"장, ";
		result+="1000원권 "+W1000+"장, ";
		result+="500원 "+W500+"개, ";
		result+="100원 "+W100+"개, ";
		result+="50원 "+W50+"개, ";
		result+="10원 "+W10+"개";
		
		
		//결과출력
		System.out.println(result);

	}

}
